﻿using Common.Communal;
using MediatR;
using Scheduling.Api.Write.Application.Command.ShiftCommand;
using Scheduling.Services.Shifts;

namespace Scheduling.Api.Write.Application.CommandHandlers.ShiftHandler
{
    public class IShiftDelCommandHandler : IRequestHandler<IShiftDelCommand, ApiResult<int>>
    {
        public IShiftDelCommandHandler(IShiftServices shiftServices)
        {
            ShiftServices = shiftServices;
        }

        public IShiftServices ShiftServices { get; }

        public async Task<ApiResult<int>> Handle(IShiftDelCommand request, CancellationToken cancellationToken)
        {
            return await ShiftServices.DeleteShift(request.ShiftId);
        }
    }
}
